﻿
{$header}
<div id="main" class="main" >
    <div class="content">
  <h3 class="heading">查看 销售分单 [ <a href="javascript:history.back(-1)">返回列表</a> ]</h3>
<div id="result" class="result none"></div>
<table cellpadding=3 cellspacing=3 >
<tr>
	<td class="tRight" >销售单号：</td>
	<td class="tLeft" >{$vo.mano}</td>
</tr>
<tr>
	<td class="tRight" >经办人：</td>
	<td class="tLeft" >
            {$vo.user_id|getModelName=User}&nbsp;&nbsp; &nbsp;&nbsp;创建时间：{$vo.create_time|toDate}
        </td>
</tr>
<tr>
	<td class="tRight" >产品：</td>
	<td class="tLeft" >
            {$vo.product_id|getModelName=Product} {$vo.product_id|getPename} {$vo.product_id|getCas}
        </td>
</tr>
<tr>
	<td class="tRight" >规格：</td>
	<td class="tLeft" >
            {$vo.specification|getModelName='Specification'}
        </td>
</tr>
<tr>
	<td class="tRight" >单价：</td>
	<td class="tLeft" >{$vo.price}</td>
</tr>
<tr>
	<td class="tRight" >数量：</td>
	<td class="tLeft" >{$vo.number} {$vo.unit_id|getModelName="Unit"}
        </td>
</tr>
<load href="__PUBLIC__/Js/My97DatePicker/WdatePicker.js" />
<tr>
	<td class="tRight" >要求交货期：</td>
	<td class="tLeft" >{$vo.delivery_date|toDate='Y-m-d'}</td>
</tr>
<tr>
	<td>状态</td><td>{$vo.status|getConfigVal='orderDetailStatus'}</td>
</tr>
<tr>
	<td>操作</td><td>{$vo.id|getActionButton}</td>
</tr>
<tr>
<td colspan=2>&nbsp;</td>
</tr>
<tr>
	<td></td>
	<td class="center" width="300">
	<a href="javascript:void(0)" onclick="javascript:history.back()" class="btn btn-primary offset1"><i class="icon-arrow-left icon-white"></i> 返回</a>
	</td>
</tr>
</table>
<table class="table table-bordered table-striped table-striped">
	<tr>
		<td>{$vo.product_id|getModelName=Product}  </td><td>{$vo.product_id|getPename}    <b class="offset1">CAS:{$vo.product_id|getCas} </b> 库存</td>
	</tr>
	<tr>
		<th>规格</th><th>库存</th>
	</tr>
	<volist name="stocks" id="st">
		<tr>
			<td>{$st.specification|getModelName='Specification'}</td><td>{$st.number}</td>
		</tr>	
	</volist>
	
</table>

<notempty name="vo.id">
<?php 
$msgs = M('Message')->where('obj_type="Order_detail" and obj_id ='.$vo['id'])->order('create_time desc')->findAll();
        
 ?>
<table class="table table-bordered">
  <tr class="alert alert-info"><td colspan=5>订单备注</td>
    <td><a class="btn btn-primary" href="__APP__/Message/add/obj_type/Order_detail/depart/仓库/obj_id/{$vo.id}/return_type/Toshipping/return_id/{$vo.id}"><i class="icon-comment icon-white"></i> 创建备注</a></td> 
  </tr>
  <tr> <td>编号</td><td>部门</td><td>留言</td><td>操作人</td>  <td>日期</td><td>修改</td> </tr>
  <!--order by create time desc-->
  <volist name="msgs" id="msg">
    <eq name="_SESSION[C('USER_AUTH_KEY')]" value="$msg.user_id"> 
      <form action="__APP__/Message/update" method="post" id="msg"
      <tr>
        <td> <input type="hidden" name="id" value="{$msg.id}">
          <input type="hidden" name="jumpUrl" value="__SELF__">
          {$msg.id}</td>
        <td>{$msg.depart}</td>
        <td><textarea name="content" class="input-xxlarge" rows="4">{$msg.content}</textarea> </td>
        <td>{$msg.user_id|getModelName='User'}</td>
        <td>{$msg.create_time|toDate}</td>
        <td> <input type="submit" class="btn btn-primary" value="修改"> </td>
      </tr>
      </form>
    <else/>
    <tr>
      <td>{$msg.id}</td>
      <td>{$msg.depart}</td>
      <td>{$msg.content}</td>
      <td>{$msg.user_id|getModelName='User'}</td>
      <td>{$msg.create_time|toDate}</td>
      <td> ---</td>
    </tr>
  </eq>
  </volist>
</table>
</notempty>

</div>
</div>

<!-- 主页面结束 --><include file="Public:footer"/>

<php>
function getActionButton($id){
	$sod = M('Order_detail');
	$sod ->getById($id);
	$status = $sod->status;
	switch($status){
		case 0: 	//待确定
			echo "<a href='__APP__/Toshipping/open_buy_task/id/".$id."' class='btn btn-primary'>库存不足，发布采购任务</a>  | <a href='__URL__/prepair/id/".$id."' class='btn btn-primary'>仓库操作中</a>";
			break;
		case 1:
		case 2: 	//待采购
			echo "---";
			break;
		case 3: 	//到货通知
			echo "<a href='__APP__/Toshipping/prepair/id/".$id."' class='btn btn-primary'>仓库操作中</a>";
			break;
		case 4: 	//到货通知
			echo "<a href='__APP__/Toshipping/doshipping/id/".$id."' class='btn btn-primary'>打包</a>";
			break;
		default:
			echo "---";
}
}
</php>

